package com.mmt.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.mmt.po.User;

@Mapper
public interface UserMapper {
	@Select("select * from users where id=#{userId}")
	@Results({
        @Result(column = "sex", property = "userSex"),  // 映射
    })
	User listUserInfoByUserId(Integer userId);

	@Insert("insert into users values(#{userid},#{userName},#{password},null,null,null,null,null,null)")
	int saveUser(User user);

	@Select("select * from users where id=#{userId} and password=#{password}")
	User getUserByIdByPass(Integer userId, String password); 

	@Results({
        @Result(column = "sex", property = "userSex"),  // 映射
    })
	@Update("update users set userName=#{userName} , sex=#{userSex} , password=#{password} where id=#{id}")
	int updateUser(User user);
	
}
